home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FPGAWKII.ZIP / LEDDIGIT.PDS < prev    next >
Text File  |  1995-01-11  |  2KB  |  59 lines

  1. ;---------------------------------------------------------
  2. ; This design decodes a 4-bit number into 7 signals which
  3. ; can drive a 7-segment LED digit.  The LEDs in the digit
  4. ; should light in a pattern that represents the number.
  5. ;---------------------------------------------------------
  6. TITLE   7-segment led decoder
  7.  
  8. ;*-- beginning of LED decoder module ---------------------
  9. DEFMOD leddigit( d0,d1,d2,d3,s0,s1,s2,s3,s4,s5,s6)
  10. CHIP   leddigit Intel_arch
  11.  
  12. PIN     d[3:0]  ; 4-bit input to the LED decoder
  13. PIN     s[6:0]  ; 7-bit output to the LED digit
  14.  
  15. ;---------------------------------------------------------
  16. ; Below is the truth table for driving the LEDs given the
  17. ; 4-bit number.  A 1 on an output will make the
  18. ; corresponding LED segment light up; a 0 will make the
  19. ; segment stay dark. The truth-table gives the appropriate
  20. ; outputs to light the LED segments for the digits 0--F.
  21. ;---------------------------------------------------------
  22. T_TAB ( d3 d2 d1 d0  >>  s0 s1 s2 s3 s4 s5 s6 ) 
  23.          0  0  0  0   :   1  1  1  0  1  1  1   ;* 0
  24.          0  0  0  1   :   0  1  0  0  1  0  0   ;* 1
  25.          0  0  1  0   :   1  0  1  1  1  0  1   ;* 2
  26.          0  0  1  1   :   1  1  0  1  1  0  1   ;* 3
  27.          0  1  0  0   :   0  1  0  1  1  1  0   ;* 4
  28.          0  1  0  1   :   1  1  0  1  0  1  1   ;* 5
  29.          0  1  1  0   :   1  1  1  1  0  1  1   ;* 6 
  30.          0  1  1  1   :   0  1  0  0  1  0  1   ;* 7
  31.          1  0  0  0   :   1  1  1  1  1  1  1   ;* 8
  32.          1  0  0  1   :   1  1  0  1  1  1  1   ;* 9
  33.          1  0  1  0   :   0  1  1  1  1  1  1   ;* A
  34.          1  0  1  1   :   1  1  1  1  0  1  0   ;* b
  35.          1  1  0  0   :   1  0  1  0  0  1  1   ;* C
  36.          1  1  0  1   :   1  1  1  1  1  0  0   ;* d
  37.          1  1  1  0   :   1  0  1  1  0  1  1   ;* E
  38.          1  1  1  1   :   0  0  1  1  0  1  1   ;* F
  39. ENDMOD
  40. ;*-- end of LED decoder module ---------------------------
  41.  
  42.  
  43.  
  44. CHIP test NFX780_84
  45.  
  46. PIN     [50:47]  d[3:0]
  47. PIN     51       unused0
  48. PIN     [77:78]  unused[1:2]
  49. PIN     [37:34]  s[3:0]
  50. PIN     [41:39]  s[6:4]
  51. MODULE  leddigit(d[3:0]=d[3:0],s[6:0]=s[6:0])
  52.  
  53. SIMULATION
  54.     VECTOR d := [d3,d2,d1,d0]
  55.     FOR i := 0 TO 15 DO
  56.         BEGIN
  57.         SETF d := i
  58.         END
  59.